package dao.impl;

import com.google.common.collect.ImmutableMap;
import dao.RatingDao;
import domain.Rating;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2015/7/3.
 */

@Repository
public class RatingDaoImpl extends BaseGenericDao<Rating, Long> implements RatingDao {

    @Override
    public Rating queryByApplierAndRecruitmentIdAndEmployee(long applier, int recruitmentId, long employee) {
        Map<String, Object> params = ImmutableMap.<String, Object>builder()
                .put("recruitment", recruitmentId)
                .put("ratee", applier)
                .put("rater", employee).build();


        return queryOne("select", params);
    }

    @Override
    public List<Rating> queryByApplier(long applier) {
        Map<String, Object> params = ImmutableMap.<String, Object>builder()
                .put("ratee", applier).build();

        return queryList("select_by_employee", params);
    }


}
